From 4bd76958c26481dfa57ce569023c9590cb43967b Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 13 Apr 2002 21:14:57 +0000 Subject: [PATCH] create the target pixbuf AFTER filling in width/height, so that passing in 2002-04-13 Havoc Pennington * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create the target pixbuf AFTER filling in width/height, so that passing in -1 for width/height will work. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gdk/gdkpixbuf-drawable.c | 16 ++++++++-------- 7 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27dcfc3206..471f9f4c96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-04-13 Havoc Pennington + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create + the target pixbuf AFTER filling in width/height, so that + passing in -1 for width/height will work. + Sat Apr 13 22:49:45 2002 Kristian Rietveld Fixes #75510 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 27dcfc3206..471f9f4c96 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2002-04-13 Havoc Pennington + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create + the target pixbuf AFTER filling in width/height, so that + passing in -1 for width/height will work. + Sat Apr 13 22:49:45 2002 Kristian Rietveld Fixes #75510 diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 27dcfc3206..471f9f4c96 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +2002-04-13 Havoc Pennington + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create + the target pixbuf AFTER filling in width/height, so that + passing in -1 for width/height will work. + Sat Apr 13 22:49:45 2002 Kristian Rietveld Fixes #75510 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 27dcfc3206..471f9f4c96 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2002-04-13 Havoc Pennington + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create + the target pixbuf AFTER filling in width/height, so that + passing in -1 for width/height will work. + Sat Apr 13 22:49:45 2002 Kristian Rietveld Fixes #75510 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 27dcfc3206..471f9f4c96 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2002-04-13 Havoc Pennington + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create + the target pixbuf AFTER filling in width/height, so that + passing in -1 for width/height will work. + Sat Apr 13 22:49:45 2002 Kristian Rietveld Fixes #75510 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 27dcfc3206..471f9f4c96 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2002-04-13 Havoc Pennington + + * gdk/gdkpixbuf-drawable.c (gdk_pixbuf_get_from_drawable): create + the target pixbuf AFTER filling in width/height, so that + passing in -1 for width/height will work. + Sat Apr 13 22:49:45 2002 Kristian Rietveld Fixes #75510 diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index 0a15d98fc3..d74ee95d2d 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -1501,14 +1501,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, g_return_val_if_fail (dest->bits_per_sample == 8, NULL); } - /* Create the pixbuf if needed */ - if (!dest) - { - dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); - if (dest == NULL) - return NULL; - } - if (cmap == NULL) cmap = gdk_drawable_get_colormap (src); @@ -1536,6 +1528,14 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, g_return_val_if_fail (src_x + width <= src_width && src_y + height <= src_height, NULL); } + /* Create the pixbuf if needed */ + if (!dest) + { + dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); + if (dest == NULL) + return NULL; + } + if (dest) { g_return_val_if_fail (dest_x >= 0 && dest_y >= 0, NULL); -- 2.30.2